package com.uit.gis.pojo;

import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import processing.core.PApplet; 
import com.uit.gis.util.JsonData;
import com.uit.gis.util.ShapeName;
import com.uit.gis.util.Util.SpatialType;
//import oracle.spatial.geometry.JGeometry;
public abstract class Shape extends PApplet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	final String OUT_PUT_DIRECTORY = "output/";
	final String EXTEND_STRING = ".json";

	ShapeName shapeName;
	SpatialType spatialType;
	private String description;
	private String elementInfor;
	private String ordinateInfor;
	private int id;
	
	private JLabel labelNotify;
	boolean continueDraw = true;
	 
	public void setName(ShapeName name) {
		this.shapeName = name;
	}

	public String getName() {
		return shapeName.getName();
	}
	public ShapeName getShapeName()
	{
		return shapeName;
	}

	public String getSavingPath() {
		return OUT_PUT_DIRECTORY + shapeName.getName() + EXTEND_STRING;
	}

	public void saveToTextFile() {
		// Notify to user
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				labelNotify.setText("Generated " + shapeName + " to file: "
						+ getSavingPath());
			}
		});
	}

	public JLabel getLabelNotify() {
		return labelNotify;
	}

	public void setLabelNotify(JLabel labelNotify) {
		this.labelNotify = labelNotify;
	}

	public abstract JsonData loadDataFromFile();

	public String getSpatialType() {
		return spatialType.type;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getElementInfor() {
		return elementInfor;
	}

	public void setElementInfor(String geometryInfor) {
		this.elementInfor = geometryInfor;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getOrdinateInfor() {
		return ordinateInfor;
	}

	public void setOrdinateInfor(String ordinateInfor) {
		this.ordinateInfor = ordinateInfor;
	}
}
